#!/bin/sh
# - runtime
# - test
# - torture_type

## creates an rcutorture kernel module that can be loaded to
## run a torture test.

. $LKP_SRC/lib/debug.sh
. $LKP_SRC/lib/reproduce-log.sh

args=""
case "$test" in
cpuhotplug)
        args=${args}" onoff_interval=3 onoff_holdoff=30"
        ;;
esac

[ -n "$torture_type" ] && args=${args}" torture_type=$torture_type"

log=$(log_cmd modprobe rcutorture $args 2>&1) || {
	echo "$log"
	echo "$log" | grep -q "Invalid argument" ||
	die "failed to load rcutorture module, try to enable CONFIG_RCU_TORTURE_TEST as module and build rcutorture.ko"
	echo "$torture_type-torture: Skip"
	exit
}

log_cmd sleep $runtime

log_cmd rmmod rcutorture 2> /dev/null

dmesg | grep torture:
